import os
import re

outFile = 'E:\doc\软著1\s40b\code'


def searchPic(path):
    p = os.listdir(path)
    for f in p:
        if os.path.isdir(path + os.sep + f):
            searchPic(path + os.sep + f)
        else:
            with open(path + os.sep + f, 'r', encoding="UTF-8") as f:
                str = f.read()
                append2File(str)


def append2File(str):
    with open(outFile, 'a', encoding="UTF-8") as f:
        f.write(str)


# def writeHtml(path, content):
#     f = open(path, 'w', encoding="UTF-8")
#     f.write(content)
#     f.close()


if __name__ == "__main__":
    base = "E:\code\dlpx\src\main\java"
    searchPic(base)
